package cn.fairy.controller;

import cn.fairy.domian.Store;
import cn.fairy.service.IStoreService;
import cn.fairy.utils.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class StoreController {
    @Autowired
    private IStoreService storeService;

    @PostMapping ("/store/add")
    public AjaxResult add(@RequestBody Store store) {
        try{
            storeService.add(store);
            return new AjaxResult();
        }catch (Exception e){
            return new AjaxResult().setSuccess(false);
        }

    }
}
